package XML.T2;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.io.File;
import java.util.List;

public class T2 {

    public static void main(String[] args) throws DocumentException {

        SAXReader sr = new SAXReader();
        Document doc = sr.read(new File("cars.xml"));
        Element rootElement = doc.getRootElement();
        List<Element> elements = rootElement.elements();
        for (Element element : elements) {
            System.out.println("车牌号码："+element.element("NO").attributeValue("DATE"));
            System.out.println("车主地址："+element.elementText("ADDR"));
        }


    }
}
